import java.awt.*;

import javax.swing.*;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class View implements ActionListener {

	private static JTextField CounterValue = new JTextField(20);

	private static int CValue;

	private static void Finestra() {

		JFrame jf = new JFrame("Title");
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jf.setSize(600, 400);
		jf.setVisible(true);
		jf.setResizable(false);
		jf.setLocation(200, 300);

		JPanel p = new JPanel();

		JPanel c = new JPanel();
		c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));
		JPanel r = new JPanel();
		r.setLayout(new BoxLayout(r, BoxLayout.Y_AXIS));

		p.add(new JLabel("counter"));

		p.add(CounterValue);

		JButton increment = new JButton("increment");
		JButton b1 = new JButton("b1");

		p.add(increment);
		jf.add(p);
		p.add(b1);

		JCheckBox c0 = new JCheckBox("c0"); // Bottoni!!!!
		JCheckBox c1 = new JCheckBox("c1");
		JCheckBox c2 = new JCheckBox("c2");
		JCheckBox c3 = new JCheckBox("c3");
		c.add(c0);
		c.add(c1);
		c.add(c2);
		c.add(c3);
		jf.add(c, BorderLayout.LINE_START);
		JRadioButton r0 = new JRadioButton("r0");
		JRadioButton r1 = new JRadioButton("r1");
		JRadioButton r2 = new JRadioButton("r2");
		JRadioButton r3 = new JRadioButton("r3");
		r.add(r0);
		r.add(r1);
		r.add(r2);
		r.add(r3);
		ButtonGroup RadioGroup = new ButtonGroup(); // il button Group serve per
													// far si che un solo radio
													// button per volta possa
													// essere selezionato
		RadioGroup.add(r0);
		RadioGroup.add(r1);
		RadioGroup.add(r2);
		RadioGroup.add(r3);

		jf.add(r, BorderLayout.EAST);

		b1.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				System.out.println("clicked");
			}

		});
		increment.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {

				CValue++;
				CounterValue.setText("Button Clicked " + CValue + " times");

			}

		});

	}

	public static void main(String[] args) {

		Finestra();

	}

	@Override
	public void actionPerformed(ActionEvent e) {

	}
}
